﻿<Window x:Class="ItemsViewerDemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ItemsViewer="clr-namespace:ItemsViewer;assembly=ItemsViewer"
        xmlns:Local="clr-namespace:ItemsViewerDemo"
        Title="ItemsViewer Demo"
        Height="600"
        Width="800">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <Border x:Name="filterPanel"
                Width="200"
                Grid.Column="0"
                Margin="5"
                Style="{StaticResource ContentBorderStyle}"
                Padding="5">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>

                <Button x:Name="btClearAll"
                        Grid.Row="0"
                        HorizontalAlignment="Right"
                        Height="18"
                        Padding="2"
                        Margin="0,0,5,0"
                        Command="{Binding ClearAllFilterCommand}">
                    <Button.Content>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="Clear All"
                                       FontSize="10"
                                       FontWeight="Normal"
                                       HorizontalAlignment="Stretch"
                                       VerticalAlignment="Top" />
                            <Image Height="12"
                                   Width="12"
                                   VerticalAlignment="Top"
                                   Stretch="Fill"
                                   Source="/ItemsViewerDemo;component/Assets/Icons/error.png"
                                   Margin="2,0,0,0" />
                        </StackPanel>
                    </Button.Content>
                </Button>

                <Grid Grid.Row="1"
                      Height="26"
                      Margin="5,5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="0.896*" />
                        <ColumnDefinition Width="0.104*" />
                    </Grid.ColumnDefinitions>
                    <Button x:Name="searchButton"
                            Style="{StaticResource SearchButtonStyle}"
                            Margin="0"
                            Grid.ColumnSpan="2"
                            Grid.Column="1"
                            Command="{Binding SearchCommand}" />
                    <TextBox x:Name="txSearch"
                             Text="{Binding SearchValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                             Margin="0,0,6,0" />
                </Grid>

                <Grid Grid.Row="2"
                      Margin="5,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0"
                               Style="{StaticResource ControlLabelStyle}">Sort :
                        <TextBlock.Foreground>
                             <LinearGradientBrush EndPoint="0.5,1"
                                                  StartPoint="0.5,0">
                                <GradientStop Color="#FF14BBD2"
                                              Offset="0" />
                                <GradientStop Color="#FF013C6C"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </TextBlock.Foreground>
                    </TextBlock >
                    <ListBox Name="listBoxSort"
                             Grid.Row="1"
                             ItemsSource="{Binding SortTypes}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <CheckBox Content="{Binding Name}"
                                          IsChecked="{Binding IsChecked}"
                                          FontSize="11"
                                          x:Name="checkSort" />
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>
                </Grid>

                <Grid Grid.Row="3"
                      Margin="5,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0"
                               Style="{StaticResource ControlLabelStyle}">Size :
                    <TextBlock.Foreground>
                             <LinearGradientBrush EndPoint="0.5,1"
                                                  StartPoint="0.5,0">
                                <GradientStop Color="#FF14BBD2"
                                              Offset="0" />
                                <GradientStop Color="#FF013C6C"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </TextBlock.Foreground>
                    </TextBlock >
                    <TextBlock Grid.Row="1"
                               Margin="0,10,0,0"
                               Style="{StaticResource ControlLabelStyle}">Over :</TextBlock >
                    <Slider x:Name="sliderSize"
                            Grid.Row="2"
                            Margin="0,5,0,0"
                            Value="{Binding SizeValue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
                            Maximum="{Binding MaximumSizeValue}"
                            PreviewMouseUp="SliderSizePreviewMouseUp"></Slider>
                </Grid>

                <Grid Grid.Row="4"
                      Margin="5,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0"
                               Style="{StaticResource ControlLabelStyle}">Scroll to item :
                    <TextBlock.Foreground>
                             <LinearGradientBrush EndPoint="0.5,1"
                                                  StartPoint="0.5,0">
                                <GradientStop Color="#FF14BBD2"
                                              Offset="0" />
                                <GradientStop Color="#FF013C6C"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </TextBlock.Foreground>
                    </TextBlock >
                    <StackPanel Orientation="Horizontal"
                                Margin="0,10,0,0"
                                Grid.Row="1"
                                HorizontalAlignment="Center">
                        <TextBox x:Name="txScroll"
                                 Width="80"
                                 Text="{Binding ScrollItemValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
                        <TextBlock Text=" / "
                                   Foreground="Gray"
                                   VerticalAlignment="Center"
                                   FontWeight="Bold" />
                        <TextBlock x:Name="txCount"
                                   Foreground="Gray"
                                   VerticalAlignment="Center"
                                   Text="{Binding CountItem}"
                                   FontWeight="Bold" />
                        <Button Padding="2"
                                Width="28"
                                x:Name="btScroll"
                                Margin="5,0,0,0"
                                Command="{Binding ScrollItemCommand}">
                            <Button.Content>
                                <Image Height="16"
                                       Width="16"
                                       VerticalAlignment="Top"
                                       Stretch="Fill"
                                       Source="/ItemsViewerDemo;component/Assets/Icons/go.png"
                                       Margin="2,0,0,0" />
                            </Button.Content>
                        </Button>
                    </StackPanel>
                </Grid>

                <Grid Grid.Row="5"
                      Margin="5,5">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto" />
                        <RowDefinition Height="auto" />
                    </Grid.RowDefinitions>
                    <TextBlock Grid.Row="0"
                               Style="{StaticResource ControlLabelStyle}">Add/Remove item:
                    <TextBlock.Foreground>
                             <LinearGradientBrush EndPoint="0.5,1"
                                                  StartPoint="0.5,0">
                                <GradientStop Color="#FF14BBD2"
                                              Offset="0" />
                                <GradientStop Color="#FF013C6C"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </TextBlock.Foreground>
                    </TextBlock >
                    <StackPanel Orientation="Horizontal"
                                Margin="0,10,0,0"
                                Grid.Row="1"
                                HorizontalAlignment="Center">
                        <Button x:Name="btAdd"
                                Content="Add"
                                Command="{Binding AddItemCommand}" />
                        <Button x:Name="btRemove"
                                Content="Remove"
                                Margin="10,0,0,0"
                                Command="{Binding RemoveItemCommand}" />
                    </StackPanel>
                </Grid>

            </Grid>
        </Border>

        <Grid Grid.Column="1">
            <ItemsViewer:ItemsViewerControl x:Name="itemViewerControl"
                                          IsSynchronizedWithCurrentItem="True"
                                          ItemsSource="{Binding PicturesView}">
                <ItemsViewer:ItemsViewerControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel>
                            <Image Source="{Binding Url}"
                                   Stretch="Fill"
                                   Height="110"
                                   Width="150" />
                            <StackPanel HorizontalAlignment="Center"
                                        Orientation="Horizontal">
                                <TextBlock Text="{Binding Name}"
                                           Foreground="Gray" />
                                <TextBlock Text=" / "
                                           Foreground="Gray" />
                                <TextBlock Text="{Binding Size}"
                                           Foreground="Gray" />
                                <TextBlock Text="KB"
                                           Foreground="Gray" />
                            </StackPanel>
                        </StackPanel>
                    </DataTemplate>
                </ItemsViewer:ItemsViewerControl.ItemTemplate>
            </ItemsViewer:ItemsViewerControl>
            <Local:CircularLoader x:Name="circularLoader"
                                  HorizontalAlignment="Center"
                                  VerticalAlignment="Center"
                                  Height="64"
                                  Width="64"
                                  IsBusy="{Binding Path=IsBusy}"></Local:CircularLoader>
        </Grid>
    </Grid>
</Window>
